package com.wcs.exam.controller.admin.resp;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * Admin-试题信息-随机抽题响应对象
 * </p>
 *
 * @author wcs
 * @since 2025-03-11
 */
@Getter
@Setter
@Accessors(chain = true)
@Schema(description = "Admin-试题信息随机抽题响应对象")
public class AdminQuestionRandomSelectionResp implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "主键")
    private Long id;

    @Schema(description = "目录ID")
    private Long categoryId;

    @Schema(description = "难度等级(1:简单、2:一般、3:困难)")
    private Integer difficultyLevel;

    @Schema(description = "题目类型(1:单选题、2:多选题、3:判断题、4:填空题、5:简答题)")
    private Integer questionType;

    @Schema(description = "题目内容")
    private String questionTitle;

    @Schema(description = "题目答案")
    private String questionAnswer;

    @Schema(description = "题目解析")
    private String questionAnalysis;

    @Schema(description = "状态")
    private Integer status;

    @Schema(description = "排序")
    private Integer sort;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "创建时间")
    private LocalDateTime gmtCreate;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Schema(description = "修改时间")
    private LocalDateTime gmtModified;

    @Schema(description = "填空数")
    private Integer optionCount;

    @Schema(description = "题目答案ID")
    private List<Long> questionAnswerIds;

    @Valid
    @Schema(description = "选项信息")
    private List<Option> options;

    @Data
    @Schema(name = "AdminQuestionRandomSelectionResp.Option", description = "Admin-试题信息-随机抽题-选项-响应对象")
    public static class Option implements Serializable {

        @Serial
        private static final long serialVersionUID = 7316087192983990523L;

        @Schema(description = "主键")
        private Long id;

        @NotBlank(message = "resource.question.question.option.option.content.not.null")
        @Schema(description = "选项内容", requiredMode = Schema.RequiredMode.REQUIRED)
        private String optionContent;

        @Schema(description = "排序")
        private Integer sort;
    }
}
